
<dl class="menu_primary" id="resMenu"></dl>

<!--Handlebars.js模版-->
<!--Handlebars.js模版放在script标签中，保留了html原有层次结构,模版中要写一些操作语句-->
<!--id可以用来唯一确定一个模版,type是模版固定的写法-->
<script id="entry-template" type="text/x-handlebars-template">
    {{#each this as |d1 i1|}}
    {{#compare d1.children.length '>' 0}}
    <dt data-leaf="1" data-hidden="{{d1.hidden}}" class="menu_title_primary closed" title="{{d1.name}}"><i class="icon_menu_switch"></i>{{d1.name}}
    </dt>
    <dd class="menu_desc_primary" style="display:none;">
        <dl class="sub_menu_primary">
            {{#each d1.children as |d2 i2|}}
            {{#compare d2.children.length '==' 0}}
    <dt data-leaf="1" data-hidden="{{d2.hidden}}" class="sub_menu_title_primary">
        <a href="#view-{{d2.id}}" data-leaf="1" data-id="{{d2.id}}" data-url="{{d2.url}}" title="{{d2.name}}"
           class="menu_link_primary no_sub"><i>●</i>{{d2.name}}</a>
    </dt>
    {{else}}
    <dt data-leaf="1" data-hidden="{{d2.hidden}}" class="sub_menu_title_primary closed">
        <a data-leaf="0" data-id="{{d2.id}}" href="#view-{{d2.id}}" class="menu_link_primary" title="{{d2.name}}"><i>●</i>{{d2.name}}</a>
    </dt>
    <dd class="sub_menu_desc_primary" style="display:none;">
        <ul>
            {{#each d2.children as |d3 i3|}}
            {{#compare d3.leaf '==' 1}}
            <li data-hidden="{{d3.hidden}}"><a href="#view-{{d3.id}}" data-leaf="1" data-id="{{d3.id}}" data-url="{{d3.url}}" title='{{d3.name}}'
                   class="menu_link_primary no_sub">{{d3.name}}</a></li>
            {{/compare}}
            {{/each}}
        </ul>
    </dd>
    {{/compare}}
    {{/each}}
    </dl>
    </dd>
    {{/compare}}
    {{/each}}
</script>

<!-- js template -->
<script>
    var result = {
        data : {$node|json_encode},
    };
</script>
